import { request } from '@/utils'
// 获取角色列表分页
export function getRoles(query) {
  return request({
    url: 'role',
    method: 'get',
    params: query,
  })
}

// 获取角色列表全部
export function getAllRoles(query) {
  return request({
    url: 'role/all',
    method: 'get',
    params: query,
  })
}

// 获取角色详情
export function getRole(roleId, data) {
  return request({
    url: `role/${roleId}`,
    method: 'get',
    data,
  })
}

export function addRole(data) {
  return request({
    url: 'role',
    method: 'post',
    data,
  })
}

export function editRole(data) {
  return request({
    url: `role`,
    method: 'put',
    data,
  })
}

export function deleteRole(roleId) {
  return request({
    url: `role/${roleId}`,
    method: 'delete',
    data: { roleId },
  })
}
